/*
 *  WaveTableWithWaveFunctionTester.cpp
 *  SoundController0002
 *
 *  Created by jiro on 10/11/13.
 *  Copyright 2010 jiro music. All rights reserved.
 *
 */

#include "WaveTableWithWaveFunctionTester.h"
#include "../SoundController.h"
#include "CustomAssert.h"

namespace sc {

	void WaveTableWithWaveFunctionTester::TestAll()
	{
		Test_subscription_001();
	}
	
	void WaveTableWithWaveFunctionTester::Test_subscription_001()
	{
		double time = 0;
		double length = 1.5;
		double powerOfX = 1;
		const WaveFunction& function = WaveFunctionFactory::CreateXSinX( powerOfX, 2 * length );
		const WaveFunction& functionRev = WaveFunctionFactory::CreateXSinX( powerOfX, 2 * length, true );
		const WaveTable& dynamicsTable = WaveTableFactory::Create( function, 1 );
		const WaveTable& dynamicsTableRev = WaveTableFactory::Create( functionRev, 1 );

		for ( ; time < length; time++ ) {
			std::stringstream ss;
			ss << "time: " << time;
			AssertEqualWithMessage( (dynamicsTable)[ time ], (dynamicsTableRev)[ length - time ], ss.str() );
		}
	}
}
